package hivi.vn.hivigold.objects;

import hivi.vn.hivigold.utils.Formats;

import java.io.Serializable;

import org.json.JSONException;
import org.json.JSONObject;

public class VoucherDetail implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String Stt_rec;
	private String Stt_rec0;
	private String CtID1;
	private String FK_VtID;
	private String VtName;
	private String FK_DvtID;
	private String Code;
	private String FK_KhoID;
	private Double So_luong;
	private Double Nguyen_gia;
	private Double Ck;
	private Double Hlg_au;
	private Double Tien_cong;
	private Double Gia_ck;
	private Double Tien;
	private Double Gia;
	private Double Gia0;
	private Double Tien0;
	private String FK_TkID_dt;
	private String FK_TkID_vt;
	private String FK_TkID_gv;
	private String user_id0;
	private String user_id2;
	private Double Gia_au;
	private Double Gia_da;
	private Double Tien_da;
	private Double Gia_cong;
	private Double Tlg_da;
	private Double Tlg_au;
	private Double Tong_tlg;
	
	public VoucherDetail() {
		// TODO Auto-generated constructor stub
	}
	public VoucherDetail(JSONObject json)
	{
		try {
			Stt_rec = json.getString("Stt_rec");
			Stt_rec0= json.getString("Stt_rec0");
			CtID1= json.getString("CtID1");
			FK_VtID= json.getString("FK_VtID");
			VtName= json.getString("VtName");
			FK_DvtID= json.getString("FK_DvtID");
			Code= json.getString("Code");
			FK_KhoID= json.getString("FK_KhoID");
			So_luong= Double.valueOf(json.getString("So_luong"));
			Nguyen_gia= Double.valueOf(json.getString("Nguyen_gia"));
			Ck= Double.valueOf(json.getString("Ck"));
			Hlg_au= Double.valueOf(json.getString("Hlg_au"));
			Tien_cong= Double.valueOf(json.getString("Tien_cong"));
			Gia_ck= Double.valueOf(json.getString("Gia_ck"));
			Tien= Double.valueOf(json.getString("Tien"));
			Gia0= Double.valueOf(json.getString("Gia0"));
			Tien0= Double.valueOf(json.getString("Tien0"));
			FK_TkID_dt= json.getString("FK_TkID_dt");
			FK_TkID_vt= json.getString("FK_TkID_vt");
			FK_TkID_gv= json.getString("FK_TkID_gv");
			user_id0= json.getString("user_id0");
			user_id2= json.getString("user_id2");
			Gia_au= Double.valueOf(json.getString("Gia_au"));
			Gia_da= Double.valueOf(json.getString("Gia_da"));
			Tien_da= Double.valueOf(json.getString("Tien_da"));
			Gia_cong= Double.valueOf(json.getString("Gia_cong"));
			Tlg_da= Double.valueOf(json.getString("Tlg_da"));
			Tlg_au= Double.valueOf(json.getString("Tlg_au"));
			Tong_tlg= Double.valueOf(json.getString("Tong_tlg"));
			Gia= Double.valueOf(json.getString("Gia"));
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		JSONObject json = new JSONObject();
		try {
			json.put("Stt_rec",getStt_rec()!=null?getStt_rec():"");
			json.put("Stt_rec0",getStt_rec0()!=null?getStt_rec0():"");
			json.put("CtID1",getCtID1()!=null?getCtID1():"");
			json.put("FK_VtID",getFK_VtID()!=null?getFK_VtID():"");
			json.put("FK_DvtID",getFK_DvtID()!=null?getFK_DvtID():"");
			json.put("Code",getCode()!=null?getCode():"");
			json.put("FK_KhoID",getFK_KhoID()!=null?getFK_KhoID():"");
			json.put("So_luong",getSo_luong()!=null?getSo_luong():0);
			json.put("Nguyen_gia",getNguyen_gia()!=null?getNguyen_gia():0);
			json.put("Ck",getCk()!=null?getCk():0);
			json.put("Hlg_au",getHlg_au()!=null?getHlg_au():0);
			json.put("Tien_cong",getTien_cong()!=null?getTien_cong():0);
			json.put("Gia_ck",getGia_ck()!=null?getGia_ck():0);
			json.put("Tien",getTien()!=null?getTien():0);
			json.put("Gia0",getGia0()!=null?getGia0():0);
			json.put("Tien0",getTien0()!=null?getTien0():0);
			json.put("FK_TkID_dt",getFK_TkID_dt()!=null?getFK_TkID_dt():"");
			json.put("FK_TkID_vt",getFK_TkID_vt()!=null?getFK_TkID_vt():"");
			json.put("FK_TkID_gv",getFK_TkID_gv()!=null?getFK_TkID_gv():"");
			json.put("user_id0",getUser_id0()!=null?getUser_id0():"");
			json.put("user_id2",getUser_id2()!=null?getUser_id2():"");
			json.put("Gia_au",getGia_au()!=null?getGia_au():0);
			json.put("Gia_da",getGia_da()!=null?getGia_da():0);
			json.put("Tien_da",getTien_da()!=null?getTien_da():0);
			json.put("Gia_cong",getGia_cong()!=null?getGia_cong():0);
			json.put("Tlg_da",getTlg_da()!=null?getTlg_da():0);
			json.put("Tlg_au",getTlg_au()!=null?getTlg_au():0);
			json.put("Tong_tlg",getTong_tlg()!=null?getTong_tlg():0);
			json.put("Gia",getGia());
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		return json.toString();
	}
	
	public String getStt_rec() {
		return Stt_rec;
	}
	public void setStt_rec(String stt_rec) {
		Stt_rec = stt_rec;
	}
	public String getStt_rec0() {
		return Stt_rec0;
	}
	public void setStt_rec0(String stt_rec0) {
		Stt_rec0 = stt_rec0;
	}
	public String getCtID1() {
		return CtID1;
	}
	public void setCtID1(String ctID1) {
		CtID1 = ctID1;
	}
	public String getFK_VtID() {
		return FK_VtID;
	}
	public void setFK_VtID(String fK_VtID) {
		FK_VtID = fK_VtID;
	}
	public String getFK_DvtID() {
		return FK_DvtID;
	}
	public void setFK_DvtID(String fK_DvtID) {
		FK_DvtID = fK_DvtID;
	}
	public String getCode() {
		return Code;
	}
	public void setCode(String code) {
		Code = code;
	}
	public String getFK_KhoID() {
		return FK_KhoID;
	}
	public void setFK_KhoID(String fK_KhoID) {
		FK_KhoID = fK_KhoID;
	}
	public Double getSo_luong() {
		return So_luong;
	}
	public void setSo_luong(Double so_luong) {
		So_luong = so_luong;
	}
	public Double getNguyen_gia() {
		return Nguyen_gia;
	}
	public void setNguyen_gia(Double nguyen_gia) {
		Nguyen_gia = nguyen_gia;
	}
	public Double getCk() {
		return Ck;
	}
	public void setCk(Double ck) {
		Ck = ck;
	}
	public Double getHlg_au() {
		return Hlg_au;
	}
	public void setHlg_au(Double hlg_au) {
		Hlg_au = hlg_au;
	}
	public Double getTien_cong() {
		return Tien_cong;
	}
	public void setTien_cong(Double tien_cong) {
		Tien_cong = tien_cong;
	}
	public Double getGia_ck() {
		return Gia_ck;
	}
	public void setGia_ck(Double gia_ck) {
		Gia_ck = gia_ck;
	}
	public Double getTien() {
		return Tien;
	}
	public void setTien(Double tien) {
		Tien = tien;
	}
	public Double getGia0() {
		return Gia0;
	}
	public void setGia0(Double gia0) {
		Gia0 = gia0;
	}
	public Double getTien0() {
		return Tien0;
	}
	public void setTien0(Double tien0) {
		Tien0 = tien0;
	}
	public String getFK_TkID_dt() {
		return FK_TkID_dt;
	}
	public void setFK_TkID_dt(String fK_TkID_dt) {
		FK_TkID_dt = fK_TkID_dt;
	}
	public String getFK_TkID_vt() {
		return FK_TkID_vt;
	}
	public void setFK_TkID_vt(String fK_TkID_vt) {
		FK_TkID_vt = fK_TkID_vt;
	}
	public String getFK_TkID_gv() {
		return FK_TkID_gv;
	}
	public void setFK_TkID_gv(String fK_TkID_gv) {
		FK_TkID_gv = fK_TkID_gv;
	}
	public String getUser_id0() {
		return user_id0;
	}
	public void setUser_id0(String user_id0) {
		this.user_id0 = user_id0;
	}
	public String getUser_id2() {
		return user_id2;
	}
	public void setUser_id2(String user_id2) {
		this.user_id2 = user_id2;
	}
	public Double getGia_au() {
		return Gia_au;
	}
	public void setGia_au(Double gia_au) {
		Gia_au = gia_au;
	}
	public Double getGia_da() {
		return Gia_da;
	}
	public void setGia_da(Double gia_da) {
		Gia_da = gia_da;
	}
	public Double getTien_da() {
		return Tien_da;
	}
	public void setTien_da(Double tien_da) {
		Tien_da = tien_da;
	}
	public Double getGia_cong() {
		return Gia_cong;
	}
	public void setGia_cong(Double gia_cong) {
		Gia_cong = gia_cong;
	}
	public Double getTlg_da() {
		return Tlg_da;
	}
	public void setTlg_da(Double tlg_da) {
		Tlg_da = tlg_da;
	}
	public Double getTlg_au() {
		return Tlg_au;
	}
	public void setTlg_au(Double tlg_au) {
		Tlg_au = tlg_au;
	}
	public Double getTong_tlg() {
		return Tong_tlg;
	}
	public void setTong_tlg(Double tong_tlg) {
		Tong_tlg = tong_tlg;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	public String getVtName() {
		return VtName;
	}
	public void setVtName(String vtName) {
		VtName = vtName;
	}
	public Double getGia() {
		return Gia;
	}
	public void setGia(Double gia) {
		Gia = gia;
	}
}
